#include<iostream>
#include<algorithm>
using namespace std;
const int N=25;
int c[N]={1};
int b[N];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>c[i];
        c[i]*=c[i-1];
    }
    
    for(int j=1;j<=n;j++){
        b[j]=(m%c[j])/c[j-1];
        cout<<b[j]<<" ";
    }
    
    
    return 0;
}
